<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/limh/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/limh/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/limh/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/limh/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/limh/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/limh/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/limh/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="教程,">










<meta name="description" content="协处理器共有68条不同的指令，汇编程序在遇到协处理器指令助忆时，都会将其转换成机器语言的ESC指令，ESC指令代表了协处理器的操作码。在协处理器指令在执行过程中，需要访问内存单元时，CPU会为其形成内存地址。协处理器在协处理器指令期间内利用数据总线来传递数据。80287协处理器利用I/O地址00FAH～00FFH来实现其与CPU之间的数据交换，而80387~Pentium系列芯片，则是利用I/O地">
<meta name="keywords" content="教程">
<meta property="og:type" content="article">
<meta property="og:title" content="11.3 协处理器的指令系统">
<meta property="og:url" content="https://tdnr.gitee.io/limh/2015/04/01/asm53/index.html">
<meta property="og:site_name" content="土逗牛肉">
<meta property="og:description" content="协处理器共有68条不同的指令，汇编程序在遇到协处理器指令助忆时，都会将其转换成机器语言的ESC指令，ESC指令代表了协处理器的操作码。在协处理器指令在执行过程中，需要访问内存单元时，CPU会为其形成内存地址。协处理器在协处理器指令期间内利用数据总线来传递数据。80287协处理器利用I/O地址00FAH～00FFH来实现其与CPU之间的数据交换，而80387~Pentium系列芯片，则是利用I/O地">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-01-23T03:19:04.297Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="11.3 协处理器的指令系统">
<meta name="twitter:description" content="协处理器共有68条不同的指令，汇编程序在遇到协处理器指令助忆时，都会将其转换成机器语言的ESC指令，ESC指令代表了协处理器的操作码。在协处理器指令在执行过程中，需要访问内存单元时，CPU会为其形成内存地址。协处理器在协处理器指令期间内利用数据总线来传递数据。80287协处理器利用I/O地址00FAH～00FFH来实现其与CPU之间的数据交换，而80387~Pentium系列芯片，则是利用I/O地">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/limh/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://tdnr.gitee.io/limh/2015/04/01/asm53/">





  <title>11.3 协处理器的指令系统 | 土逗牛肉</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans ">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/limh/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">土逗牛肉</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/limh/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/limh/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/limh/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/limh/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/limh/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://tdnr.gitee.io/limh/limh/2015/04/01/asm53/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="土逗牛肉">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/limh/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="土逗牛肉">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">11.3 协处理器的指令系统</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2015-04-01T20:36:18+08:00">
                2015-04-01
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/limh/categories/汇编教程/" itemprop="url" rel="index">
                    <span itemprop="name">汇编教程</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>协处理器共有68条不同的指令，汇编程序在遇到协处理器指令助忆时，都会将其转换成机器语言的ESC指令，ESC指令代表了协处理器的操作码。<br>在协处理器指令在执行过程中，需要访问内存单元时，CPU会为其形成内存地址。协处理器在协处理器指令期间内利用数据总线来传递数据。80287协处理器利用I/O地址00FAH～00FFH来实现其与CPU之间的数据交换，而80387~Pentium系列芯片，则是利用I/O地址800000FAH～800000FFH来实现这两者之间的数据交换。</p>
<h2 id="11-3-1-指令操作符的命名规则"><a href="#11-3-1-指令操作符的命名规则" class="headerlink" title="11.3.1 指令操作符的命名规则"></a>11.3.1 指令操作符的命名规则</h2><p>协处理器指令的操作符(或助忆符)在命名设计时，遵循了下列规则：</p>
<ol>
<li>在操作符后面加上字母P：表示该指令执行完后，还进行一次堆栈弹出操作。如：FADD和FADDP等；</li>
<li>在操作符后面加上字母R：表示该操作是反模式，它仅限于减法、除法指令。如：FSUB和FSUBR等；<br>正模式 —— 栈顶数据＝栈顶数据 op 指令操作数，或OPN1＝OPN1 – OPN2<br>反模式 —— 栈顶数据＝指令操作数 op 栈顶数据，或OPN1＝OPN2 – OPN1<br>假设：栈顶数据为10，内存变量data的值为1，分别执行下列指令将有不同的结果。<br><br>FSUB data ;指令执行后，栈顶数据为9<br><br>FSUBR data ;指令执行后，栈顶数据为-9<br><br>FSUB ST, ST(1) ;指令执行后，ST=ST-ST(1)<br><br>FSUBR ST, ST(1) ;指令执行后，ST=ST(1)-ST<br></li>
<li><p>操作符的第2个字母是I：表示内存中数据是整数。它对加、减、乘除指令都有效。<br>例如：FADD　data——浮点数加法；<br>FIADD　data——整数加法，它表示内存单元data是一个整数，把该整数加到栈顶的浮点数上。</p>
</li>
<li><p>操作符的第2个字母是N：表示在指令执行之前检查非屏蔽数值性错误。如：FSAVE和FNSAVE等，前者称为等待形式(wait version)，后者称为非等待形式(no-wait version)。</p>
</li>
</ol>
<p>在使用.8087伪指令情况下，汇编程序会在等待形式的指令前面加上指令WAIT，而在非等待形式的指令前面加上空操作指令NOP。</p>
<p>理解了上述操作符命名规则，就能很容易地区分同类指令之间的差异。</p>
<h2 id="11-3-2-数据传送指令"><a href="#11-3-2-数据传送指令" class="headerlink" title="11.3.2 数据传送指令"></a>11.3.2 数据传送指令</h2><p>为了满足协处理器和CPU之间进行数据交流的需求，就需要实现内存单元和协处理器之间进行数据传送的指令。协处理器的指令系统中有三大类数据传送指令：BCD传送指令、浮点数传送和整数传送指令。</p>
<h3 id="一、BCD传送指令"><a href="#一、BCD传送指令" class="headerlink" title="一、BCD传送指令"></a>一、BCD传送指令</h3><h4 id="1、FBLD"><a href="#1、FBLD" class="headerlink" title="1、FBLD"></a>1、FBLD</h4><p>指令格式：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">FBLD　MemBCD(*)</span><br></pre></td></tr></table></figure>
<p>指令功能：将内存中的BCD数据压入协处理器的堆栈中；</p>
<p>(*) MemType是指定数据类型Type的内存单元，如：MemBCD是BCD类型的存储单元。此后不再说明。</p>
<h4 id="2、FBSTP"><a href="#2、FBSTP" class="headerlink" title="2、FBSTP"></a>2、FBSTP</h4><p>指令格式：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">FBSTP　MemBCD</span><br></pre></td></tr></table></figure>
<p>指令功能：将协处理器中的BCD数据存入内存，并进行堆栈的弹出操作。</p>
<p>例如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">.387</span><br><span class="line"></span><br><span class="line">data1 DT　123, -543</span><br><span class="line"></span><br><span class="line">data2 DT　2.5</span><br><span class="line"></span><br><span class="line">……</span><br><span class="line"></span><br><span class="line">FBLD data1 ;把BCD数据123压进栈 </span><br><span class="line"></span><br><span class="line">FBSTP data2 ;把当前堆顶数据弹出，并传送给BCD型的内参单元</span><br></pre></td></tr></table></figure>
<h3 id="二、浮点数传送指令"><a href="#二、浮点数传送指令" class="headerlink" title="二、浮点数传送指令"></a>二、浮点数传送指令</h3><h4 id="1、FLD"><a href="#1、FLD" class="headerlink" title="1、FLD"></a>1、FLD</h4><p>指令格式： </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">FLD　STReg(*)/MemReal</span><br></pre></td></tr></table></figure>
<p>指令功能： 将浮点数据压入协处理器的堆栈中。当进行内存单元内容压栈时，系统会自动决定传送数据的精度。比如：用DD或REAL4定义的内存单元数值是单精度数等。</p>
<p>(*) STReg是协处理器堆栈寄存器ST(0)~ST(7)。</p>
<p>例如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">.387</span><br><span class="line"></span><br><span class="line">data1 DD　123, -543</span><br><span class="line"></span><br><span class="line">data2 REAL8　-321.5</span><br><span class="line"></span><br><span class="line">data3 REAL10　2.5</span><br><span class="line"></span><br><span class="line">……</span><br><span class="line"></span><br><span class="line">FLD data1 ;压一个单精度数据进栈 </span><br><span class="line"></span><br><span class="line">FLD data2 ;压一个双精度数据进栈 </span><br><span class="line"></span><br><span class="line">FLD ST(0) ;把堆栈寄存器ST(0)的值再压进栈 </span><br><span class="line"></span><br><span class="line">FLD data3 ;压一个扩展精度数据进栈</span><br></pre></td></tr></table></figure>
<h4 id="2、FST"><a href="#2、FST" class="headerlink" title="2、FST"></a>2、FST</h4><p>指令格式： </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">FST  STReg/MemReal</span><br></pre></td></tr></table></figure>
<p>指令功能： 将协处理器堆栈栈顶的数据传送到目标操作数中。在进行数据传送时，系统自动根据控制寄存器中舍入控制位的设置把栈顶浮点数舍入成相应精度的数据。</p>
<h4 id="3、FSTP"><a href="#3、FSTP" class="headerlink" title="3、FSTP"></a>3、FSTP</h4><p>指令格式： </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">FSTP  STReg/MemReal</span><br></pre></td></tr></table></figure>
<p>指令功能： 与FST相类似，所不同的是：指令FST执行完后，不进行堆栈的弹出操作，即：堆栈不发生变化，而指令FSTP执行完后，则需要进行堆栈的弹出操作，堆栈将发生变化。请见11.3.1节中的指令操作符命名规则的说明。</p>
<h4 id="4、FXCH"><a href="#4、FXCH" class="headerlink" title="4、FXCH"></a>4、FXCH</h4><p>指令格式： </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">FXCH　[STReg]</span><br></pre></td></tr></table></figure>
<p>指令功能： 将指定的寄存器中的浮点数与堆顶浮点数进行交换。如果不指定操作数，那么，默认ST和ST(1)二者之间交换数据。</p>
<p>例如：FXCH  ST(2)——栈顶数据与堆栈寄存器ST(2)进行数据交换。 </p>
<h3 id="三、整数传送指令"><a href="#三、整数传送指令" class="headerlink" title="三、整数传送指令"></a>三、整数传送指令</h3><h4 id="1、FILD"><a href="#1、FILD" class="headerlink" title="1、FILD"></a>1、FILD</h4><p>指令格式：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">FILD　MemInt</span><br></pre></td></tr></table></figure>
<p>其中：MemInt是定义为整型数据类型的内存单元，但不能是用DB定义的存储单元。下同，不再叙述。</p>
<h4 id="2、FIST-FISTP"><a href="#2、FIST-FISTP" class="headerlink" title="2、FIST/FISTP"></a>2、FIST/FISTP</h4><p>指令格式： </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">FIST　MemInt</span><br></pre></td></tr></table></figure>
<p>FISTP　MemInt</p>
<p>其中： Mem是定义整型数据类型的内存单元，但不能是用DB定义的存储单元。</p>
<p>指令功能： 将协处理器堆栈栈顶的数据传送到目标存储单元中。在进行数据传送时，系统自动根据控制寄存器中舍入控制位的设置把栈顶浮点数舍入成整型数据。</p>
<p>指令FIST和FISTP的区别在于堆栈操作，详细请见11.3.1中的命名规则说明。</p>
<h3 id="11-3-3-数学运算指令"><a href="#11-3-3-数学运算指令" class="headerlink" title="11.3.3 数学运算指令"></a>11.3.3 数学运算指令</h3><p>在协处理器的指令系统中，有关数学运算指令有：加法指令、减法指令、乘法指令、除法指令和求平方根指令等。涉及数学运算的指令有比例运算、舍入运算、求绝对值运算和改变数值符号运算等指令。</p>
<h4 id="1、加法指令"><a href="#1、加法指令" class="headerlink" title="1、加法指令"></a>1、加法指令</h4><p>指令格式：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">&lt;p&gt;FADD [STReg1, STReg2](*)&lt;/p&gt;</span><br><span class="line"></span><br><span class="line">FADD MemReal</span><br><span class="line"></span><br><span class="line">FADDP STReg, ST</span><br><span class="line"></span><br><span class="line">FIADD MemInt</span><br></pre></td></tr></table></figure>
<p>(*) 在此指令格式下，如果同时指定了二个堆栈寄存器，那么，其中一个寄存器必须是ST。其它指令的同类格式与此同理。</p>
<ul>
<li>指令FADD含有二个隐含操作数ST(1)和ST，其运算功能是：从堆栈中弹出这二个操作数，然后把计算的“和”压入堆栈，即：ST＝ST(1)+ST。</li>
<li>指令“FADD MemReal”的功能：ST＝ST+MemReal</li>
<li>指令“FADDP STReg, ST”的功能：STReg＝STReg+ST，并弹出堆栈的栈顶</li>
<li>指令“FIADD MemInt”的功能：ST＝ST+MemInt</li>
</ul>
<h4 id="2、减法指令"><a href="#2、减法指令" class="headerlink" title="2、减法指令"></a>2、减法指令</h4><p>指令格式：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">FSUB [STReg1, STReg2]</span><br><span class="line"></span><br><span class="line">FSUB MemReal</span><br><span class="line"></span><br><span class="line">FSUBP STReg, ST</span><br><span class="line"></span><br><span class="line">FISUB MemInt</span><br><span class="line"></span><br><span class="line">FSUBR [STReg1, STReg2] ;后四条指令是前四条指令的反模式形式</span><br><span class="line"></span><br><span class="line">FSUBR MemReal</span><br><span class="line"></span><br><span class="line">FSUBRP? STReg,ST</span><br><span class="line"></span><br><span class="line">FISUBR? MemInt</span><br></pre></td></tr></table></figure>
<ul>
<li>指令FSUB含有二个隐含操作数ST(1)和ST，其运算功能是：从堆栈中弹出这二个操作数，然后把计算的“差”压入堆栈，即：ST＝ST(1)-ST。</li>
<li>指令“FSUB MemReal”的功能：ST＝ST-MemReal</li>
<li>指令“FSUBP STReg, ST”的功能：STReg＝STReg-ST，并弹出堆栈的栈顶</li>
<li>指令“FISUB MemInt”的功能：ST＝ST-MemInt</li>
</ul>
<p>反模式的四条指令的功能在此从略，请参阅11.3.1中的有关说明。</p>
<h4 id="3、乘法指令"><a href="#3、乘法指令" class="headerlink" title="3、乘法指令"></a>3、乘法指令</h4><p>指令格式：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">FMUL [STReg1, STReg2]</span><br><span class="line"></span><br><span class="line">FMUL MemReal</span><br><span class="line"></span><br><span class="line">FMULP STReg, ST</span><br><span class="line"></span><br><span class="line">FIMUL MemInt</span><br></pre></td></tr></table></figure>
<h4 id="4、除法指令"><a href="#4、除法指令" class="headerlink" title="4、除法指令"></a>4、除法指令</h4><p>指令格式：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">FDIV [STReg1, STReg2]</span><br><span class="line"></span><br><span class="line">FDIV MemReal</span><br><span class="line"></span><br><span class="line">FDIVP STReg, ST</span><br><span class="line"></span><br><span class="line">FIDIV MemInt</span><br><span class="line"></span><br><span class="line">FDIVR [STReg1, STReg2] ;后四条指令是前四条指令的反模式形式</span><br><span class="line"></span><br><span class="line">FDIVR MemReal</span><br><span class="line"></span><br><span class="line">FDIVRP STReg, ST</span><br><span class="line"></span><br><span class="line">FIDIVR MemInt</span><br></pre></td></tr></table></figure>
<p>例如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line">.387</span><br><span class="line"></span><br><span class="line">word1 DW　20</span><br><span class="line"></span><br><span class="line">data1 REAL8　8</span><br><span class="line"></span><br><span class="line">data2 REAL8　-2</span><br><span class="line"></span><br><span class="line">data3 REAL8　-12</span><br><span class="line"></span><br><span class="line">……</span><br><span class="line"></span><br><span class="line">FLD data1 ;本例只是显示指令的使用方法，无具体的实际功能 </span><br><span class="line"></span><br><span class="line">FLD data2</span><br><span class="line"></span><br><span class="line">FLD data3</span><br><span class="line"></span><br><span class="line">FDIV ST(2), ST</span><br><span class="line"></span><br><span class="line">FDIV data1</span><br><span class="line"></span><br><span class="line">FDIVP ST(2), ST</span><br><span class="line"></span><br><span class="line">FIDIV word1</span><br></pre></td></tr></table></figure>
<h4 id="5、其它数学运算指令"><a href="#5、其它数学运算指令" class="headerlink" title="5、其它数学运算指令"></a>5、其它数学运算指令</h4><p>在协处理器中，除了完成具体的数学运算指令外，还设置了若干个与数学运算有关的运算指令。具体的运算指令及其功能描述如表11.4所列。</p>
<p><strong>表11.4 与数学运算有关的其它指令</strong></p>
<table cellspacing="0" cellpadding="2"><tr><td><p>指令格式</p></td><td><p>指令的功能</p></td></tr><tr><td><p>FSQRT</p></td><td><p>求栈顶数据的平方根。如果对负数求其平方根，则会发生错误，并可通过检测状态寄存器的标志位IE来确定。</p></td></tr><tr><td><p>FSCALE</p></td><td><p>将ST(1)中的数(转换成整数)加上ST的阶码，该指令能快速完成乘/除2n的运算。ST(1)中的数必须在2-15到215之间。</p></td></tr><tr><td><p>FPREM/FPREM1</p></td><td><p>ST＝ST%ST(1)，80387及其以后的协处理器支持FPREM1。</p></td></tr><tr><td><p>FRNDINT</p></td><td><p>对栈顶数据进行舍入运算，使之转换成整数。</p></td></tr><tr><td><p>FXTRACT</p></td><td><p>将栈顶数据分成二部分：无偏阶码和尾数。尾数存入栈顶，无偏阶码存入ST(1)。它常用将浮点数转换成小数形式打印输出。</p></td></tr><tr><td><p>FABS</p></td><td><p>ST＝|ST|，即：求栈顶数据的绝对值。</p></td></tr><tr><td><p>FCHS</p></td><td><p>ST＝-ST，即：改变栈顶数据的符号。</p></td></tr>  </table>

<h2 id="11-3-4-比较运算指令"><a href="#11-3-4-比较运算指令" class="headerlink" title="11.3.4 比较运算指令"></a>11.3.4 比较运算指令</h2><p>使用比较指令是将栈顶中的数与其它操作数进行比较，比较结果存于状态寄存器的条件编码位C3~C0处(参阅表11.2)。具体的比较运算指令及其功能描述如表11.5所列。</p>
<p><strong>表11.5 比较运算指令及其功能</strong></p>
<table border="0" cellspacing="0" cellpadding="0"><tr><td> 指令格式 </td><td>指令的功能 </td></tr><tr><td valign="top"><p>FCOM</p></td><td><p>将栈顶数据与另一个操作数进行比较，该操作数可以存储在堆栈寄存器中，也可存储在内存中。 </p>当在指令中不指定操作数时，其默认的操作数是ST和ST(1)。 </td></tr><tr><td valign="top"><p>FCOMP/FCOMPP</p></td><td>此指令的比较功能与FCOM相一致，所不同的是指出从堆栈中弹出一个，还是二个数据。 </td></tr><tr><td valign="top"><p>FICOM　MemInt</p>FICOMP　MemInt </td><td valign="top"><p>栈顶数据与内存单元进行整数比较。指令FICOMP还要弹出栈顶数据。 </p></td></tr><tr><td valign="top"><p>FUCOM　[STReg]</p><p> FUCOMP　[STReg]</p>FUCOMPP </td><td valign="top"><p>反向比较，其功能与上面同类指令类似。 </p></td></tr><tr><td valign="top"><p>FTST</p></td><td>栈顶数据与0进行比较。比较结果对条件编码位的影响如表11.2所示。 </td></tr><tr><td valign="top"><p>FXAM</p></td><td>检测栈顶数据是正数、负数，还是规格化数。比较结果对条件编码位的影响如表11.2所示。 </td></tr></table>

<p>﻿</p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/limh/tags/教程/" rel="tag"># 教程</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/limh/2015/04/01/asm52/" rel="next" title="11.2 协处理器的结构">
                <i class="fa fa-chevron-left"></i> 11.2 协处理器的结构
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/limh/2015/04/01/asm54/" rel="prev" title="11.4 协处理器的编程举例">
                11.4 协处理器的编程举例 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="SOHUCS"></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/limh/images/avatar.jpg" alt="土逗牛肉">
            
              <p class="site-author-name" itemprop="name">土逗牛肉</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/limh/archives/">
              
                  <span class="site-state-item-count">255</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/limh/categories/index.html">
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/limh/tags/index.html">
                  <span class="site-state-item-count">7</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/limhGeek" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:1591054297@qq.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.jianshu.com/u/f73b243e7cc9" target="_blank" title="简书">
                      
                        <i class="fa fa-fw fa-user-circle-o"></i>简书</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#11-3-1-指令操作符的命名规则"><span class="nav-number">1.</span> <span class="nav-text">11.3.1 指令操作符的命名规则</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#11-3-2-数据传送指令"><span class="nav-number">2.</span> <span class="nav-text">11.3.2 数据传送指令</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#一、BCD传送指令"><span class="nav-number">2.1.</span> <span class="nav-text">一、BCD传送指令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1、FBLD"><span class="nav-number">2.1.1.</span> <span class="nav-text">1、FBLD</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2、FBSTP"><span class="nav-number">2.1.2.</span> <span class="nav-text">2、FBSTP</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#二、浮点数传送指令"><span class="nav-number">2.2.</span> <span class="nav-text">二、浮点数传送指令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1、FLD"><span class="nav-number">2.2.1.</span> <span class="nav-text">1、FLD</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2、FST"><span class="nav-number">2.2.2.</span> <span class="nav-text">2、FST</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3、FSTP"><span class="nav-number">2.2.3.</span> <span class="nav-text">3、FSTP</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#4、FXCH"><span class="nav-number">2.2.4.</span> <span class="nav-text">4、FXCH</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#三、整数传送指令"><span class="nav-number">2.3.</span> <span class="nav-text">三、整数传送指令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1、FILD"><span class="nav-number">2.3.1.</span> <span class="nav-text">1、FILD</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2、FIST-FISTP"><span class="nav-number">2.3.2.</span> <span class="nav-text">2、FIST/FISTP</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#11-3-3-数学运算指令"><span class="nav-number">2.4.</span> <span class="nav-text">11.3.3 数学运算指令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1、加法指令"><span class="nav-number">2.4.1.</span> <span class="nav-text">1、加法指令</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2、减法指令"><span class="nav-number">2.4.2.</span> <span class="nav-text">2、减法指令</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3、乘法指令"><span class="nav-number">2.4.3.</span> <span class="nav-text">3、乘法指令</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#4、除法指令"><span class="nav-number">2.4.4.</span> <span class="nav-text">4、除法指令</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#5、其它数学运算指令"><span class="nav-number">2.4.5.</span> <span class="nav-text">5、其它数学运算指令</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#11-3-4-比较运算指令"><span class="nav-number">3.</span> <span class="nav-text">11.3.4 比较运算指令</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">土逗牛肉</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
	var str = GetUrlParam('height');
    if (str === '0'){
		document.getElementById('header').style.display = 'none';
		document.getElementById('comments').style.display = 'none';
		document.getElementById('footer').style.display = 'none';
		document.getElementsByClassName('post-footer').item(0).style.display = 'none'
	}
	
    function GetUrlParam(paraName) {
        var url = document.location.toString();
        var arrObj = url.split("?");

        if (arrObj.length > 1) {
            var arrPara = arrObj[1].split("&");
            var arr;

            for (var i = 0; i < arrPara.length; i++) {
                 arr = arrPara[i].split("=");

                if (arr != null && arr[0] === paraName) {
                    return arr[1];
                }
            }
            return "";
        } else {
            return "";
        }
    }
</script>









  












  
  
    <script type="text/javascript" src="/limh/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/limh/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/limh/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/limh/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/limh/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/limh/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/limh/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/limh/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
